import random

# 业务需求 V1.0
# number = random.randint(0,100)
# while 1:
#     guessnumber = int(input("请输入猜的数字："))
#     if guessnumber > number:
#         print("大了")
#     elif guessnumber < number:
#         print("小了")
#     elif guessnumber == number:
#         print("恭喜猜中，本轮幸运数字：{}".format(guessnumber))
#         break

# 业务需求 V2.0
# number = random.randint(0,100)
# gold = 5000
# while gold > 0:
#     guessnumber = int(input("请输入猜的数字："))
#     if guessnumber > number:
#         print("大了")
#         gold -= 500
#     elif guessnumber < number:
#         print("小了")
#         gold -= 500
#     elif guessnumber == number:
#         print("恭喜猜中，本轮幸运数字：{}".format(guessnumber))
#         gold += 3000
#         break
# if gold <= 0:
#     print("余额不足")

# 业务需求 V3.0
number = random.randint(0,100)
gold = 5000
while gold > 0:
    guessnumber = int(input("请输入猜的数字："))
    if guessnumber > number:
        print("大了")
        gold -= 500
    elif guessnumber < number:
        print("小了")
        gold -= 500
    elif guessnumber == number:
        print("恭喜猜中，本轮幸运数字：{}".format(guessnumber))
        gold += 3000
        nextgame = input("是否继续下一轮游戏（请输入继续或者退出）:")
        if nextgame == "继续":
            number = random.randint(0, 100)
            continue
        else:
            break
if gold <= 0:
    print("余额不足")

